package net.wangds.jpa.repository;

import net.wangds.data.RemovedEnum;
import net.wangds.data.WithId;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.NoRepositoryBean;

import java.util.List;
import java.util.Optional;

@NoRepositoryBean
public interface RemovableRepo<T extends WithId<String>> extends JpaRepository<T, String> {

    Optional<T> findByIdAndRemoved(String id, RemovedEnum removed);

    Page<T> findByRemoved(RemovedEnum removed, Pageable page);


    List<T> findByRemoved(RemovedEnum removed, Sort sort);

}
